[Chapter 28] 28.3 The Workspace
Author: Bryan Costales & Eric Allman
Date: 1999-01-06T19:50:15Z

#

| Chapter 28 Rules |

## 28.3 The Workspace

As was mentioned, rules exist to rewrite addresses. We won't cover the reasons this rewriting needs to be done just yet but will instead concentrate on the general behavior of rewriting.

Before any rules are called to perform rewriting, a temporary buffer called the &"workspace" is created. The address to be rewritten is then tokenized and placed into that workspace. The process of tokenizing addresses in the workspace is exactly the same as the tokenizing of rules that you saw before:

>     gw@wash.dc.gov    becomes   gw  @  wash  .  dc  . gov

Here, the tokenizing characters defined by the `OperatorChars` (pre-V8.7, `$o`) option (see Section 34.8.45) and those defined internally by sendmail caused the address to be broken into seven tokens. The process of rewriting changes the tokens in the workspace:

>     		 workspace is "gw" "@" "wash" "." "dc" "." "gov"
>     Rlhs rhs
>     Rlhs rhs		 rules rewrite the workspace
>     Rlhs rhs
>     		 workspace is "gw" "." "LOCAL"

Here, the workspace began with seven tokens. The three hypothetical rules recognized that this was a local address (in token form) and rewrote it so that it became three tokens.

28.2 Tokenizing Rules |  | 28.4 The Behavior of a Rule